﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BrainTechLLC;

namespace UserInterface
{
	public partial class EditorForm : Form
	{
		protected object _editor;
		protected object _item;
		protected object Item
		{
			get { return _item; }
			set
			{
				_item = value;
				UpdateBindings();
			}
		}

		public void SetItem(object o)
		{
			Item = o;
		}

		public void UpdateBindings()
		{
			if (_item != null)
			{
				GameChar o1 = _item as GameChar;
				Template o2 = _item as Template;
				GameThingBaseClass o3 = _item as GameThingBaseClass;
				if (o1 != null)
				{
					GameCharEditor e1 = new GameCharEditor();
					Controls.Add(e1);
					e1.Dock = DockStyle.Fill;
					e1.SetItem(o1);
					_editor = e1;
				}
				else if (o2 != null)
				{
					TemplateEditor e1 = new TemplateEditor();
					Controls.Add(e1);
					e1.Dock = DockStyle.Fill;
					e1.SetItem(o2);
					_editor = e1;
				}
				else if (o3 != null)
				{
					BaseGameThingEditor e1 = new BaseGameThingEditor();
					Controls.Add(e1);
					e1.Dock = DockStyle.Fill;
					e1.SetItem(o3);
					_editor = e1;
				}

			}
		}


		public EditorForm()
		{
			InitializeComponent();
		}
	}
}
